/**
 * 
 */
package fr.aprr.odyssee.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.Widget;

/**
 * @author PHAM
 *
 */
public class VehiculePanel extends Composite{

	private static VehiculePanelUiBinder uiBinder = GWT
			.create(VehiculePanelUiBinder.class);

	interface VehiculePanelUiBinder extends UiBinder<Widget, VehiculePanel> {
	}

	/**
	 * Because this class has a default constructor, it can
	 * be used as a binder template. In other words, it can be used in other
	 * *.ui.xml files as follows:
	 * <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
	 *   xmlns:g="urn:import:**user's package**">
	 *  <g:**UserClassName**>Hello!</g:**UserClassName>
	 * </ui:UiBinder>
	 * Note that depending on the widget that is used, it may be necessary to
	 * implement HasHTML instead of HasText.
	 */
	
	public static final String TEXT_ITEM = "Vehicule";
	public static final String TEXT_TREE = "Type";
	

	
	@UiField (provided = true)
	Tree vehitree;
	
	public VehiculePanel() {
		
		vehitree = createStaticTree();
		
		
		initWidget(uiBinder.createAndBindUi(this));
	}

	public VehiculePanel(String firstName) {
		initWidget(uiBinder.createAndBindUi(this));

	}
    
	private Tree createStaticTree(){
		Tree tree = new Tree();
		
		for (int i = 1; i < 4; i++) {
			TreeItem treeItem = tree.addTextItem(TEXT_TREE +" " +i);
			for (int j = 1; j < 5; j++) {
				treeItem.addTextItem(TEXT_ITEM +" "+j);
			}
			treeItem.setState(true);
		}
		return tree;
	}
	
	
}
